/*
 * @# PostsCommentsServiceImpl.java 2011-12-19 下午03:14:55
 * 
 * Copyright (C) 2010 - 2011 广州羿安信息科技有限公司
 * Guangzhou ianswer information technology co. ltd.
 * 
 * All rights reserved!
 */
package com.ianswer.px.posts.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.ianswer.common.orm.PublicDao;
import com.ianswer.px.posts.entity.PostComment;
import com.ianswer.px.posts.service.PostCommentService;

/**
 * @author alvin hwang
 */
@Service("postCommentService")
public class PostCommentServiceImpl implements PostCommentService {

	@Resource(name = "publicDao")
	private PublicDao publicDao;

	@Override
	public Long insert(PostComment postComment) {
		return (Long) publicDao.insert("postsComments.insert", postComment);
	}

	@Override
	public void delete(Long id) {
		publicDao.delete("postsComments.delete", id);
	}

	@Override
	public List<PostComment> query(Long postId, int pageIndex) {
		PostComment postComment = new PostComment();
		postComment.setPostId(postId);
		postComment.setPageIndex(pageIndex);
		return publicDao.query("postsComments.query", postComment);
	}

	@Override
	public PostComment get(Long id) {
		return publicDao.querySingle("postsComments.get", id);
	}

}
